/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidades;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Miguel
 */
@Entity
@Table(name = "horarioaula")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Horarioaula.findAll", query = "SELECT h FROM Horarioaula h"),
    @NamedQuery(name = "Horarioaula.findByIdHorarioAula", query = "SELECT h FROM Horarioaula h WHERE h.idHorarioAula = :idHorarioAula"),
    @NamedQuery(name = "Horarioaula.findByDia", query = "SELECT h FROM Horarioaula h WHERE h.dia = :dia"),
    @NamedQuery(name = "Horarioaula.findByAnulado", query = "SELECT h FROM Horarioaula h WHERE h.anulado = :anulado")})
public class Horarioaula implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idHorarioAula")
    private Integer idHorarioAula;
    @Basic(optional = false)
    @Column(name = "dia")
    private String dia;
    @Column(name = "anulado")
    private Boolean anulado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "horarioAulaidHorarioAula")
    private Collection<Asignacionperiodoaula> asignacionperiodoaulaCollection;
    @JoinColumn(name = "Semestre_idSemestre", referencedColumnName = "idSemestre")
    @ManyToOne(optional = false)
    private Semestre semestreidSemestre;
    @JoinColumn(name = "Aula_idAula", referencedColumnName = "idAula")
    @ManyToOne(optional = false)
    private Aula aulaidAula;

    public Horarioaula() {
    }

    public Horarioaula(Integer idHorarioAula) {
        this.idHorarioAula = idHorarioAula;
    }

    public Horarioaula(Integer idHorarioAula, String dia) {
        this.idHorarioAula = idHorarioAula;
        this.dia = dia;
    }

    public Integer getIdHorarioAula() {
        return idHorarioAula;
    }

    public void setIdHorarioAula(Integer idHorarioAula) {
        this.idHorarioAula = idHorarioAula;
    }

    public String getDia() {
        return dia;
    }

    public void setDia(String dia) {
        this.dia = dia;
    }

    public Boolean getAnulado() {
        return anulado;
    }

    public void setAnulado(Boolean anulado) {
        this.anulado = anulado;
    }

    @XmlTransient
    public Collection<Asignacionperiodoaula> getAsignacionperiodoaulaCollection() {
        return asignacionperiodoaulaCollection;
    }

    public void setAsignacionperiodoaulaCollection(Collection<Asignacionperiodoaula> asignacionperiodoaulaCollection) {
        this.asignacionperiodoaulaCollection = asignacionperiodoaulaCollection;
    }

    public Semestre getSemestreidSemestre() {
        return semestreidSemestre;
    }

    public void setSemestreidSemestre(Semestre semestreidSemestre) {
        this.semestreidSemestre = semestreidSemestre;
    }

    public Aula getAulaidAula() {
        return aulaidAula;
    }

    public void setAulaidAula(Aula aulaidAula) {
        this.aulaidAula = aulaidAula;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idHorarioAula != null ? idHorarioAula.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Horarioaula)) {
            return false;
        }
        Horarioaula other = (Horarioaula) object;
        if ((this.idHorarioAula == null && other.idHorarioAula != null) || (this.idHorarioAula != null && !this.idHorarioAula.equals(other.idHorarioAula))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Horarioaula[ idHorarioAula=" + idHorarioAula + " ]";
    }
    
}
